//
//    Copyright (C) 2012  OinkStudio
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.

package main;

public class DadesUsuari {
	private String user = "";
	private String pass = "";
	private String bbdd = "";
	private String url_acces = "";
	private String url_mysql = "";
	private String language = "";

	public String getUser() {

		return user;
	}

	public String getPass() {
		return pass;
	}

	public String getBbdd() {
		return bbdd;
	}
	
	public String getUrl() {
		return url_mysql;
	}
	
	public String getLanguage(){
		return language;
	}

	public DadesUsuari() {
		Fitxer ft = new Fitxer("configuration/base.conf");
		boolean sortir = false;
		String[] dada = new String[2];
		dada[0] = ft.linea();

		while (!sortir) {
			if (dada[0] == null) {
				sortir = true;
			} else {
				dada = dada[0].split("=");
				if (dada[0].contains("user")) {
					user = dada[1];
				} else if (dada[0].contains("pass")) {
					pass = dada[1];
				} else if (dada[0].contains("bbdd")) {
					bbdd = dada[1];
				} else if (dada[0].contains("url_acces")) {
					url_acces = dada[1];
				} else if (dada[0].contains("url_mysql")) {
					url_mysql = dada[1];
				}else if(dada[0].contains("language")){
					language = dada[1];
				}else {
					sortir = true;
				}
				dada[0] = ft.linea();
			}
		}
	}
}
